﻿using System;
using System.Runtime.Serialization;

namespace CapstoneProjectAEReader.Entities.Models
{
    [Serializable()]
    public class NoteDetail : ISerializable
    {
        private int _noteid;
        private int _bookid;
        private string _createdate;
        private string _description;
        private int _pageNumber;

        public NoteDetail() { }
        public int Noteid
        {
            get { return _noteid; }
            set { _noteid = value; }
        }

        public int Bookid
        {
            get { return _bookid; }
            set { _bookid = value; }
        }

        public string Createdate
        {
            get { return _createdate; }
            set { _createdate = value; }
        }

        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }
        
        public int PageNumber
        {
            get { return _pageNumber; }
            set { _pageNumber = value; }
        }

        // Serialize
        public NoteDetail(SerializationInfo info, StreamingContext ctxt)
        {
            _noteid = (int)info.GetValue("NoteId", typeof(int));
            _bookid = (int)info.GetValue("Bookid", typeof(int));
            _createdate = (string)info.GetValue("Createdate", typeof(string));
            _description = (string)info.GetValue("Description", typeof(string));
            _pageNumber = (int) info.GetValue("PageNumber", typeof (int));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("NoteId", _noteid);
            info.AddValue("Bookid", _bookid);
            info.AddValue("Createdate", _createdate);
            info.AddValue("Description", _description);
            info.AddValue("PageNumber",_pageNumber);
        }
    }
}
